/***
author : sailing
date : 2016/12/22
*****/

<style lang='less'>
.ftablea {
  margin-top: 0px;
  width:100%;
  position:relation;
  .searchtable {
    width:100%;
    height: 40px;
    background:red;
  }
}
</style>

<template>
  <div class='ftablea'>
    <ul>
    <el-table
    :data="fiberData"
    :height="mainHeight"
    :default-sort = "{prop: 'datetime', order: 'descending'}"
    border
    style="width: 100%">
    <el-table-column
      type="index"
      label='#'
      width="100">
    </el-table-column>
    <el-table-column
<<<<<<< HEAD
      prop="start"
      label="起点"
      width="180">
    </el-table-column>
    <el-table-column
      prop="end"
      width='180'
      label="终点">
    </el-table-column>
    <el-table-column
      prop="cores"
      width= '180'
      label="芯数">
    </el-table-column>
    <el-table-column
      prop="len"
      width= '180'
      label="距离">
    </el-table-column>
    <el-table-column
      prop="create_time"
      label="创建日期">
=======
      prop="content"
      label="操作"
      sortable
      width="200">
    </el-table-column>
    <el-table-column
      prop="user_name"
      label="用户名"
      sortable
      width="200">
    </el-table-column>
    <el-table-column
      prop="ip"
      label="ip"
      sortable
      width="200">
    </el-table-column>
    <el-table-column
      prop="level"
      label="日志级别"
      sortable
      width="120">
>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
    </el-table-column>
    <el-table-column
      prop="user_id"
      width= '180'
      sortable
      label="用户ID">
    </el-table-column>
    <el-table-column
      prop="datetime"
      sortable
      label="日期">
    </el-table-column>
    </el-table>
    </ul>
    <ul>
       <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="50"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
    </ul>
  </div>
</template>

<script>
import eventBus from '../../eventBus'
import addFiber from '../../server/addFiber'
<<<<<<< HEAD
=======
import search from '../search'
>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
export default {
  data () {
    return {
      mainHeight: 500,
<<<<<<< HEAD
      fiberData: []
=======
      currentPage: 1,
      total: 0,
      fiberData: [],
      formInline: {
        user: '',
        region: ''
      }
>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
    }
  },
  methods: {
    refreshBnt (index, data) {
      eventBus.bus.$emit('refreshFiber', data[index])
    },
    showAllPort (index, data) {
      eventBus.bus.$emit('showAllPort', data[index])
    },
    handleCurrentChange (val) {
      eventBus.bus.$emit('changePage', {page: val})
    },
    handleSizeChange (val) {

    }
<<<<<<< HEAD
=======

>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
  },
  mounted () {
    const that = this
    var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
    this.mainHeight = h - 140
<<<<<<< HEAD
    eventBus.bus.$on('getFiberList', function (items) {
      that.fiberData = items
=======
    eventBus.bus.$on('getFiberList', function (data) {
      addFiber.setLevel(data.items)
      console.log('setLevel: ', data.items)
      that.fiberData = data.items
      that.total = data.total
>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
    })
    eventBus.bus.$on('addFiberData', function (data) {
      addFiber.addEl(that, data)
    })
    eventBus.bus.$on('refreshFiberData', function (data) {
      addFiber.refresh(data)
    })
<<<<<<< HEAD
=======
  },
  components: {
    search
>>>>>>> 118bfb24f1cbdee8aba2f4af5269fcf3bfe2e597
  }
}
</script>
